//

class OwnArray{
    static from(){  //类上的静态方法
        console.log("form=======");
    }

    fill(){
        console.log("fill=======")
    }
}

let arr = new OwnArray();

// arr.from();

// OwnArray.from();

arr.fill();

//数组

//1. new 数组实例  2. 字面量

let arr1 = new Array(3);


arr1.fill('a');
console.log(arr1);


let arr2 = ['a','b','c'];

console.log(arr2);


arr1.push(4);

//Array.of()  //把一组值转为数组

console.log(Array.of(1,2,9))

//find 第一个符合条件的元素  findIndex 第一个符合元素的下标 -1

let test = arr2.findIndex((item) => item==='p');

console.log(test);

//keys()下标组成的遍历器对象  values()值组成的遍历器对象  entries()  返回遍历器对象

console.log(arr2.keys());

// let obj = {name:'lili'}

// for(let key in obj){
//     console.log(key);
// }
let inter1 = arr2.entries();

// for(let key of inter1){
//     console.log(key);
// }

console.log(inter1.next());

console.log(inter1.next());

console.log(inter1.next());

console.log(inter1.next());

//copyWithin()  替换

console.log([1, 2, 3, 4, 5].copyWithin(0, 3))

//flat 

let arr6 = [5,6,[7,8,[9]]];

console.log(arr6.flat(2))

